using Core.Model;

namespace Infrastructure.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<Infrastructure.Database.PetshopDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
            AutomaticMigrationDataLossAllowed = true;

        }

        protected override void Seed(Infrastructure.Database.PetshopDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //


            Category fish = new Category {CategoryId = "FISH", Name = "Fish", BannerData = @"<img src=""Images/bannerFish.gif"">"};
            Category dogs = new Category {CategoryId = "DOGS", Name = "Dogs", BannerData = @"<img src=""Images/bannerDogs.gif"">"};
            Category reptiles = new Category
                                    {
                                        CategoryId = "REPTILES",
                                        Name = "Reptiles",
                                        BannerData = @"<img src=""Images/bannerReptiles.gif"">"
                                    };
            Category cats = new Category {CategoryId = "CATS", Name = "Cats", BannerData = @"<img src=""Images/bannerCats.gif"">"};
            Category birds = new Category
                                    {CategoryId = "BIRDS", Name = "Birds", BannerData = @"<img src=""Images/bannerBirds.gif"">"};

            context.Categories.AddOrUpdate(fish,dogs,reptiles,cats,birds);

         

             fish = context.Categories.SingleOrDefault(c => c.CategoryId == "FISH");
             dogs = context.Categories.SingleOrDefault(c => c.CategoryId == "DOGS");
             reptiles = context.Categories.SingleOrDefault(c => c.CategoryId == "REPTILES");
             cats = context.Categories.SingleOrDefault(c => c.CategoryId == "CATS");
             birds = context.Categories.SingleOrDefault(c => c.CategoryId == "BIRDS");

            context.Products.AddOrUpdate(new Product() {ProductId = "FI-SW-01", Category = fish , Name = "Angelfish", Description  = @"Saltwater fish from Australia" });
            ////context.Products.AddOrUpdate(new Product() { ProductId = "FI-SW-01", Category = fish, Name = "Angelfish", Description = @"<img align=""absmiddle"" src=""Images/Pets/fish1.jpg"">Saltwater fish from Australia" });

            var angelFish = context.Products.SingleOrDefault(p => p.ProductId == "FI-SW-01");

            context.Items.AddOrUpdate(new Item() { ItemId = "EST-1", Name = "Large", Price = Convert.ToDecimal(16.50), Product = angelFish, Quantity = 100 });
            context.Items.AddOrUpdate(new Item() { ItemId = "EST-2", Name = "Small", Price = Convert.ToDecimal(16.50), Product = angelFish, Quantity = 100 });
          
            Account account = new Account() {Address1 = "Main street ", Address2 = "127" , Category = birds, City = "Austin" , Country = "USA", Email = "my@home.com" , FirstName = "Alexander", IsShowBanners = true, IsShowFavorites = true, Language = "English", LastName = "Nowak", Password = "secret" , Phone = "099-999-999", State = "Texas", UserId = "DOTNET" , Zip = "1290"};

            context.Accounts.AddOrUpdate(account);

            context.SaveChanges(); 

//             INSERT INTO [Product] VALUES ('FI-SW-01', 'FISH', 'Angelfish', '<img align="absmiddle" src="Images/Pets/fish1.jpg">Saltwater fish from Australia')
//INSERT INTO [Product] VALUES ('FI-SW-02', 'FISH', 'Tiger Shark', '<img align="absmiddle" src="Images/Pets/fish2.jpg">Saltwater fish from Australia')
//INSERT INTO [Product] VALUES ('FI-FW-01', 'FISH', 'Koi', '<img align="absmiddle" src="Images/Pets/fish3.jpg">Freshwater fish from Japan')
//INSERT INTO [Product] VALUES ('FI-FW-02', 'FISH', 'Goldfish', '<img align="absmiddle" src="Images/Pets/fish4.jpg">Freshwater fish from China')
//INSERT INTO [Product] VALUES ('K9-BD-01', 'DOGS', 'Bulldog', '<img align="absmiddle" src="Images/Pets/dog1.jpg">Friendly dog from England')
//INSERT INTO [Product] VALUES ('K9-PO-02', 'DOGS', 'Poodle', '<img align="absmiddle" src="Images/Pets/dog2.jpg">Cute dog from France')
//INSERT INTO [Product] VALUES ('K9-DL-01', 'DOGS', 'Dalmation', '<img align="absmiddle" src="Images/Pets/dog3.jpg">Great dog for a fire station')
//INSERT INTO [Product] VALUES ('K9-RT-01', 'DOGS', 'Golden Retriever', '<img align="absmiddle" src="Images/Pets/dog4.jpg">Great family dog')
//INSERT INTO [Product] VALUES ('K9-RT-02', 'DOGS', 'Labrador Retriever', '<img align="absmiddle" src="Images/Pets/dog5.jpg">Great hunting dog')
//INSERT INTO [Product] VALUES ('K9-CW-01', 'DOGS', 'Chihuahua', '<img align="absmiddle" src="Images/Pets/dog6.jpg">Great companion dog')
//INSERT INTO [Product] VALUES ('RP-SN-01', 'REPTILES', 'Rattlesnake', '<img align="absmiddle" src="Images/Pets/reptile1.jpg">Doubles as a watch dog')
//INSERT INTO [Product] VALUES ('RP-LI-02', 'REPTILES', 'Iguana', '<img align="absmiddle" src="Images/Pets/reptile2.jpg">Friendly green friend')
//INSERT INTO [Product] VALUES ('FL-DSH-01', 'CATS', 'Manx', '<img align="absmiddle" src="Images/Pets/cat1.jpg">Great for reducing mouse populations')
//INSERT INTO [Product] VALUES ('FL-DLH-02', 'CATS', 'Persian', '<img align="absmiddle" src="Images/Pets/cat2.jpg">Friendly house cat, doubles as a princess')
//INSERT INTO [Product] VALUES ('AV-CB-01', 'BIRDS', 'Amazon Parrot', '<img align="absmiddle" src="Images/Pets/bird1.jpg">Great companion for up to 75 years')
//INSERT INTO [Product] VALUES ('AV-SB-02', 'BIRDS', 'Finch', '<img align="absmiddle" src="Images/Pets/bird2.jpg">Great stress reliever')



//            INSERT INTO [Item] VALUES ('EST-1', 'FI-SW-01', 16.50, 10.00,  'P', 'Large', 10000)
//INSERT INTO [Item] VALUES ('EST-2', 'FI-SW-01', 16.50, 10.00,  'P', 'Small', 10000)
//INSERT INTO [Item] VALUES ('EST-3', 'FI-SW-02', 18.50, 12.00,  'P', 'Toothless', 10000)
//INSERT INTO [Item] VALUES ('EST-4', 'FI-FW-01', 18.50, 12.00,  'P', 'Spotted', 10000)
//INSERT INTO [Item] VALUES ('EST-5', 'FI-FW-01', 18.50, 12.00,  'P', 'Spotless',10000)
//INSERT INTO [Item] VALUES ('EST-6', 'K9-BD-01', 18.50, 12.00,  'P', 'Male Adult', 10000)
//INSERT INTO [Item] VALUES ('EST-7', 'K9-BD-01', 18.50, 12.00,  'P', 'Female Puppy', 10000)
//INSERT INTO [Item] VALUES ('EST-8', 'K9-PO-02', 18.50, 12.00,  'P', 'Male Puppy', 10000)
//INSERT INTO [Item] VALUES ('EST-9', 'K9-DL-01', 18.50, 12.00,  'P', 'Spotless Male Puppy', 10000)
//INSERT INTO [Item] VALUES ('EST-10', 'K9-DL-01', 18.50, 12.00,  'P', 'Spotted Adult Female',10000)
//INSERT INTO [Item] VALUES ('EST-11', 'RP-SN-01', 18.50, 12.00,  'P', 'Venomless', 10000)
//INSERT INTO [Item] VALUES ('EST-12', 'RP-SN-01', 18.50, 12.00,  'P', 'Rattleless', 10000)
//INSERT INTO [Item] VALUES ('EST-13', 'RP-LI-02', 18.50, 12.00,  'P', 'Green Adult', 10000)
//INSERT INTO [Item] VALUES ('EST-14', 'FL-DSH-01', 58.50, 12.00,  'P', 'Tailless', 10000)
//INSERT INTO [Item] VALUES ('EST-15', 'FL-DSH-01', 23.50, 12.00,  'P', 'Tailed', 10000)
//INSERT INTO [Item] VALUES ('EST-16', 'FL-DLH-02', 93.50, 12.00,  'P', 'Adult Female', 10000)
//INSERT INTO [Item] VALUES ('EST-17', 'FL-DLH-02', 93.50, 12.00,  'P', 'Adult Male', 10000)
//INSERT INTO [Item] VALUES ('EST-18', 'AV-CB-01', 193.50, 92.00,  'P', 'Adult Male', 10000)
//INSERT INTO [Item] VALUES ('EST-19', 'AV-SB-02', 15.50, 2.00,  'P', 'Adult Male', 10000)
//INSERT INTO [Item] VALUES ('EST-20', 'FI-FW-02', 5.50, 2.00,  'P', 'Adult Male', 10000)
//INSERT INTO [Item] VALUES ('EST-21', 'FI-FW-02', 5.29, 1.00,  'P', 'Adult Female', 10000)
//INSERT INTO [Item] VALUES ('EST-22', 'K9-RT-02', 135.50, 100.00,  'P', 'Adult Male', 10000)
//INSERT INTO [Item] VALUES ('EST-23', 'K9-RT-02', 145.49, 100.00,  'P', 'Adult Female', 10000)
//INSERT INTO [Item] VALUES ('EST-24', 'K9-RT-02', 255.50, 92.00,  'P', 'Adult Male', 10000)
//INSERT INTO [Item] VALUES ('EST-25', 'K9-RT-02', 325.29, 90.00,  'P', 'Adult Female', 10000)
//INSERT INTO [Item] VALUES ('EST-26', 'K9-CW-01', 125.50, 92.00,  'P', 'Adult Male', 10000)
//INSERT INTO [Item] VALUES ('EST-27', 'K9-CW-01', 155.29, 90.00,  'P', 'Adult Female', 10000)
//INSERT INTO [Item] VALUES ('EST-28', 'K9-RT-01', 155.29, 90.00,  'P', 'Adult Female', 10000)
//INSERT INTO [Item] VALUES ('EST-29', 'K9-RT-01', 178.29, 90.00,  'P', 'Adult unkown', 2500)
       
   
            
        }
    }
}
